home *** CD-ROM | disk | FTP | other *** search
- // CURSOR.H
-
- #ifndef __CURSOR_H_ // Draws and hides (draws with reverse color)
- #define __CURSOR_H_ // symbol '_' under current position
-
- #include <graphics.h>
- #include <alloc.h>
-
- class Cursor
- {
- protected:
- int cx, cy;
- public:
- Cursor() { cx = cy = 0; }
- void show_cursor()
- {
- int i_size = imagesize(0, 0, 3, textheight("M") + 1);
- void* image = (void*)malloc(i_size);
- getimage(cx, cy - textheight("M"), cx, cy, image);
- putimage(cx, cy - textheight("M"), image, NOT_PUT);
- delete image;
- }
-
- void hide_cursor() { show_cursor(); }
- void set_cursor(int x, int y)
- {
- ::moveto(cx = x, cy = y);
- }
- };
-
- #endif __CURSOR_H_